package x.ovo.wechat.bot.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 心跳检查状态码
 *
 * @author ovo on 2024/04/19.
 * @since 1.0.0
 */
@Getter
@RequiredArgsConstructor
public enum SyncCheckRetCode {
    NORMAL(0, "正常"),
    TICK_ERROR(-14, "ticket错误"),
    PARAM_ERROR(1, "传入参数错误"),
    LOGIN_OUT(1100, "已登出微信"),
    LOGIN_OTHERWISE(1101, "未登录微信"),
    MOBILE_LOGIN_OUT(1102, "cookie值无效"),
    LOGIN_FAIL(1203, "当前登录环境异常"),
    OFTEN(1205, "操作频繁"),
    UNKNOWN(9999, "未知");

    private final int code;
    private final String message;

    public static SyncCheckRetCode get(int code) {
        for (SyncCheckRetCode retCode : values()) {
            if (retCode.code == code) {
                return retCode;
            }
        }
        return UNKNOWN;
    }
}
